{include="header"}

<div class="container-fluid">
   <div class="row" style="margin-top: 10px;">
      <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
         <a class="btn btn-sm btn-default" href="{$fsc->url()}" title="Recargar la página">
            <span class="glyphicon glyphicon-refresh"></span>
         </a>
      </div>
      <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 text-right">
         <form id="f_buscar_documento" name="f_buscar_documento" action="{$fsc->url()}" method="post" class="form form-inline">
            <div class="input-group">
               <input class="form-control" type="text" name="query" value="{$fsc->query}" autocomplete="off" placeholder="Buscar">
               <span class="input-group-btn hidden-xs hidden-sm">
                  <button class="btn btn-primary" type="submit">
                     <span class="glyphicon glyphicon-search"></span>
                  </button>
               </span>
            </div>
         </form>
      </div>
   </div>
   
   <div class="row">
      <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
         <h1>
            <a href="{$fsc->url()}">Documentos</a>
         </h1>
      </div>
   </div>
</div>

<div class="table-responsive">
    <table class="table table-condensed">
        <thead>
            <tr>
                <th class="text-left">Identificador</th>
                <th class="text-left">Descripción</th>
                <th class="text-right" width="120">Acciones</th>
            </tr>
        </thead>
        <tbody>
         {loop="$fsc->listar_documentos()"}
         <form action="{$fsc->url()}" method="post" class="form">
            <input type="hidden" name="iddocumento" value="{$value->iddocumento}"/> 
            <tr>
                <td> 
                    <div class="form-control">{$value->iddocumento}</div>
                </td>
                <td>
                    <input class="form-control" type="text" name="descripcion" value="{$value->descripcion}" size="100" autocomplete="off"/>
                </td>
                <td class="text-right">
                  <div class="btn-group">
                     <a class="btn btn-sm btn-danger" href="{$fsc->url()}&delete={$value->iddocumento}" title="Eliminar">
                        <span class="glyphicon glyphicon-trash"></span>
                     </a>
                     <button class="btn btn-sm btn-primary" type="submit" onclick="this.disabled=true; this.form.submit();" title="Guardar">
                        <span class="glyphicon glyphicon-floppy-disk"></span>
                     </button>
                  </div>
               </td>
            </tr>
         </form>  
         {else}
          <tr class="bg-warning">
            <td colspan="7">Sin resultados</td>
         </tr>
         {/loop}
         
         {if condition="$fsc->query==''"}
         <form action="{$fsc->url()}" method="post" class="form">
            <tr class="bg-info">
               <td>
                  <div class="form-control">Nuevo</div>
               </td>
               <td>
                  <input class="form-control" type="text" name="descripcion" autocomplete="off"/>
               </td>
               <td class="text-right">
                  <button class="btn btn-sm btn-primary" type="submit" onclick="this.disabled=true; this.form.submit();" title="Guardar">
                     <span class="glyphicon glyphicon-floppy-disk"></span>
                  </button>
               </td>
            </tr>
         </form>
        {/if}
        </tbody>
    </table>
</div>
{include="footer"}
